var POPUP_FADE_OUT_TIME = 0.1; // seconds
var DISABLE_HOVER_TIMEOUT = 500; // milliseconds
+var NO_MODS_TIMEOUT = 1500; // milliseconds
function mod(a, b) {
return (a + b) % b;
this._motionTimeoutId = 0;
this._initialDelayTimeoutId = 0;
+ this._noModsTimeoutId = 0;
// Initially disable hover so we ignore the enter-event if
// the switcher appears underneath the current pointer location
// https://bugzilla.gnome.org/show_bug.cgi?id=596695 for
// details.) So we check now. (Have to do this after updating
// selection.)
- let [x, y, mods] = global.get_pointer();
- if (!(mods & this._modifierMask)) {
- this._finish(global.get_current_time());
- return false;
+ if (this._modifierMask) {
+ let [x, y, mods] = global.get_pointer();
+ if (!(mods & this._modifierMask)) {
+ this._finish(global.get_current_time());
+ return false;
+ }
+ } else {
+ this._resetNoModsTimeout();
}
// We delay showing the popup so that fast Alt+Tab users aren't
},
_keyReleaseEvent: function(actor, event) {
- let [x, y, mods] = global.get_pointer();
- let state = mods & this._modifierMask;
-
- if (state == 0)
- this._finish(event.get_time());
+ if (this._modifierMask) {
+ let [x, y, mods] = global.get_pointer();
+ let state = mods & this._modifierMask;
+
+ if (state == 0)
+ this._finish(event.get_time());
+ } else {
+ this._resetNoModsTimeout();
+ }
return Clutter.EVENT_STOP;
},
return GLib.SOURCE_REMOVE;
},
+ _resetNoModsTimeout: function() {
+ if (this._noModsTimeoutId != 0)
+ Mainloop.source_remove(this._noModsTimeoutId);
+
+ this._noModsTimeoutId = Mainloop.timeout_add(NO_MODS_TIMEOUT,
+ Lang.bind(this, function () {
+ this._finish(global.get_current_time());
+ this._noModsTimeoutId = 0;
+ return GLib.SOURCE_REMOVE;
+ }));
+ },
+
_popModal: function() {
if (this._haveModal) {
Main.popModal(this.actor);
Mainloop.source_remove(this._motionTimeoutId);
if (this._initialDelayTimeoutId != 0)
Mainloop.source_remove(this._initialDelayTimeoutId);
+ if (this._noModsTimeoutId != 0)
+ Mainloop.source_remove(this._noModsTimeoutId);
},
_select: function(num) {